<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>
<header id="topnav" style="background: #264a9e; opacity: 1;">
	<div class="topbar-main" >
		<div class="container-fluid text-white">
			<!-- 日期时间显示 -->
			<%--<div class="header-datetime">
				<p>当前时间：<br /><span id="dateTime"></span></p>
			</div>--%>
			<!-- Logo container-->
			<div class="logo">
				<!-- Text Logo -->
				<!--<a href="index.html" class="logo">-->
				<!--<span class="logo-small"><i class="mdi mdi-radar"></i></span>-->
				<!--<span class="logo-large"><i class="mdi mdi-radar"></i> Abstack</span>-->
				<!--</a>-->
				<!-- Image Logo -->
				<a href="index.html" class="">
					GNSS解算结果监测系统
					<!-- <img src="assets/images/logo.png" alt="" height="16" class="logo-large"> -->
					<!-- <img src="assets/images/logo_sm.png" alt="" height="26" class="logo-small"> -->
				</a>
			</div>
			<!-- End Logo container-->
			<div class="menu-extras topbar-custom">
				<ul class="list-unstyled topbar-right-menu <%--float-right--%> mb-0">
					<li class="menu-item">
						<!-- Mobile menu toggle-->
						<a class="navbar-toggle nav-link">
							<div class="lines">
								<span></span>
								<span></span>
								<span></span>
							</div>
						</a>
						<!-- End mobile menu toggle-->
					</li>
					<%--<li class="dropdown notification-list">
						<a class="nav-link dropdown-toggle waves-effect waves-light nav-user" data-toggle="dropdown" href="#" role="button"
						   aria-haspopup="false" aria-expanded="false">
							<img src="<c:url value='/images/user.png'/>" alt="user" class="rounded-circle"> <span class="ml-1 pro-user-name">${userSession.userName}<i class="mdi mdi-chevron-down"></i> </span>
						</a>
						<div class="dropdown-menu dropdown-menu-right profile-dropdown ">
							<!-- item-->
							<div class="dropdown-item noti-title">
								<h6 class="text-overflow m-0">欢迎 !</h6>
							</div>
							<!-- item-->
							<a href="javascript:void(0);" id="changePassword" class="dropdown-item notify-item">
								<i class="fi-head"></i> <span>修改密码</span>
							</a>
							<!-- item-->
							<a href="${pageContext.servletContext.contextPath }/login.html" class="dropdown-item notify-item">
								<i class="fi-power"></i> <span>安全退出</span>
							</a>
						</div>
					</li>--%>
				</ul>
			</div>
			<!-- end menu-extras -->
			<div class="clearfix"></div>
		</div> <!-- end container -->
	</div>
	<!-- end topbar-main -->
</header>
<!--  监管范围模态框 -->
<div id="changePasswordModal" class="modal fade" data-backdrop="static" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
	<form id="changePasswordForm" method="post" action="<c:url value='/user/updatePassword.html'/>" role="form">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
					<h5 class="modal-title" id="supervisionModalLabel">修改密码</h5>
				</div>
				<div class="modal-body">
					<div class="form-group row">
						<label for="oldPassword" class="col-sm-3 col-form-label">旧密码<span class="text-danger">*</span></label>
						<div class="col-sm-9">
							<input type="password" class="form-control" id="oldPassword" required minlength="6" maxlength="20" placeholder="旧密码">
						</div>
					</div>
					<div class="form-group row">
						<label for="newPassword" class="col-sm-3 col-form-label">新密码<span class="text-danger">*</span></label>
						<div class="col-sm-9">
							<input type="password" class="form-control" id="newPassword" required minlength="6" maxlength="20" placeholder="新密码">
						</div>
					</div>
					<div class="form-group row">
						<label for="cfmPassword" class="col-sm-3 col-form-label">确认密码<span class="text-danger">*</span></label>
						<div class="col-sm-9">
							<input type="password" class="form-control" id="cfmPassword" required minlength="6" maxlength="20" placeholder="确认密码">
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
					<button type="submit" class="btn btn-primary">保存</button>
				</div>
			</div><!-- /.modal-content -->
		</div><!-- /.modal-dialog -->
	</form>
</div><!-- /.modal -->
<!-- End Navigation Bar-->
<script type="text/javascript">
	$(function(){
		//编辑窗体提交验证
		editValidataSubmit("changePasswordForm", beforeSubmit, "changePasswordModal", null);
	});

	//初始化日期时间
	let initDateTime = () =>{
		let date = new Date();
		let dateTime = dateTimeFormatter(date);
		$("#dateTime").text(dateTime);
	}

	let beforeSubmit = formData =>{
		let oldPassword = $("#oldPassword").val();
		let newPassword = $("#newPassword").val();
		let cfmPassword = $("#cfmPassword").val();
		formData.push({ name: 'oldPassword', value: hex_sha1(oldPassword) });
		formData.push({ name: 'newPassword', value: hex_sha1(newPassword) });
		formData.push({ name: 'cfmPassword', value: hex_sha1(cfmPassword) });
	}

	//显示修改密码弹出层
	$("#changePassword").click(function(){
		$("#changePasswordModal").modal("show");
		$("#changePasswordForm")[0].reset();
	});

</script>